Listing 1 Creating a tween track and tween media
Track t;
Media md;
SampleDescriptionHandle desc;
// ...
// set up the movie, m
// ...
// allocate a sample description handle
desc = (SampleDescriptionHandle)NewHandleClear (
sizeof (SampleDescription));
// create the tween track, t
t = NewMovieTrack (m, 0, 0, kNoVolume);
// create the tween media, md
md = NewTrackMedia (t, TweenMediaType, 600, nil, 0);
(**desc).descSize = sizeof(SampleDescription);
Next, your application must create a tween media sample. The tween media sample is a QT atom container structure that contains one or more kTweenEntry atoms. (See Chapter 1, "Movie Toolbox," for additional information on QT atom containers.) Each kTweenEntry atom defines a separate tween operation. A single tween sample can describe several parallel tween operations.
The sample code shown in Listing 2 creates a new QT atom container and inserts a kTweenEntry atom into the container. Then, it creates two leaf atoms, both children of the kTweenEntry atom. The first leaf atom (atom type kTweenType ) contains the type of the tween data, in this case kTweenTypeShort . The second leaf atom (atom type kTweenData ) contains the two data values for the tween operation, 512 and 0.
Remember that all data in QT atoms must be big-endian. The sample code shown in this chapter contains the endian conversion routines required for cross-platform compatibility.
| Previous | Chapter Contents | Chapter Top | Next |